home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_13_05
/
allison
/
tdate2.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-03-12
|
687b
|
32 lines
LISTING 6 - Tests the new Date type
/* tdate2.c */
#include <stdio.h>
#include "date2.h"
#define DATELEN 19
main()
{
Date *d1 = date_create(10,1,1951),
*d2 = date_create(3,7,1995);
char buf[DATELEN+1];
int cmp;
printf("d1 == %s\n",date_format(d1,buf));
printf("d2 == %s\n",date_format(d2,buf));
cmp = date_compare(d1,d2);
printf("d1 %s d2\n",(cmp < 0) ? "precedes"
: (cmp > 0) ? "follows"
: "equals");
date_destroy(d1);
date_destroy(d2);
return 0;
}
/* Output:
d1 == October 1, 1951
d2 == March 7, 1995
d1 precedes d2
*/